# -*- coding: utf-8 -*-
import sys
import logging

if __name__ == "__main__":

    logging.basicConfig(level=logging.DEBUG,
                        format='%(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s %(message)s',
                        datefmt='%a, %d %b %Y %H:%M:%S',
                        filename='myapp.log',
                        filemode='w')

    print "脚本名：", sys.argv[0]
    logging.debug('脚本名: %s', sys.argv[0])
    for i in range(1, len(sys.argv)):
        logging.debug('参数: %d, 值为%s', i, sys.argv[i])
